<style>
  table {text-align:center;}
  thead tr{}
  tbody tr:nth-child(even){background:#F5F5F5;}
  tbody tr:nth-child(odd){background:#EECFA1;}
</style>
<template>
  <div>

          <div>
            名称:<input name="name" v-model="name">
          </div>
          <div>
            电话号码:<input name="phoneNum" v-model="phoneNum">
          </div>
          <div>
            身份证号:<input name="identityCard" v-model="identityCard">
          </div>
          <div>
            居住地址:<input name="address" v-model="address">
          </div>
          <div>
            活动区域:<input name="activityArea" v-model="activityArea">
          </div>
          <Button v-on:click='submit()'>提交</Button>
  </div>
</template>

<script>
import axios from 'axios'
import qs from 'qs'
export default {
  data () {
    return {
      name: '',
      phoneNum: '',
      identityCard: '',
      address: '',
      activityArea: ''
    }
  },
  created () {

  },
  methods: {
    submit () {
      var obj = this
      var parames = {
        name: obj.name,
        phoneNum: obj.phoneNum,
        identityCard: obj.identityCard,
        activityArea: obj.activityArea,
        address: obj.address
      }
      var url = '/api/targetStaff/singleAddTargetStaff'
      axios.post(url, parames)
        .then(res => {
          if (res.data.success == true) {
            alert('添加成功')
            obj.name = ''
            obj.phoneNum = ''
            obj.identityCard = ''
            obj.activityArea = ''
            obj.address = ''
          } else {
            alert(res.data.errMsg)
          }
        })
    }
  }
}
</script>

<style>

</style>
